package com.xxl.spring.homework;

import com.xxl.spring.bean.Car;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class homeworkTest {
    protected static ClassPathXmlApplicationContext applicationContext;
    protected static BeanFactory beanFactory;
    protected static ClassPathXmlApplicationContext context;
    @BeforeClass
    public static void beforeClass() {
        applicationContext = new ClassPathXmlApplicationContext("applictionContext.xml");
        beanFactory = new ClassPathXmlApplicationContext("applictionContext.xml");
        context = new ClassPathXmlApplicationContext("Context.xml");
    }
    @Test
    public void test(){
        Car carAC = applicationContext.getBean("carAC", Car.class);
        System.out.println("carAC = " + carAC);
        carAC.run();
        Car carBF = beanFactory.getBean("carBF", Car.class);
        System.out.println("carBF = " + carBF);
        carBF.run();
        Car carContext = context.getBean("car", Car.class);
        System.out.println("carContext = " + carContext);
        carContext.run();
    }
}
